<template>
    <div>
      <!--   <header class="header clearfix">
            <div class="hd-title">健康资讯</div>
            <a href="javascript:void(0)" class="return" @click="returnlist"></a>
        </header> -->
        <div class="newsdetail">
            <!-- <div class="newsdetailtitimg">
                <img :src="newsitem.healthMessage.infoTitlePicture" width="100%">
            </div> -->
            <div class="newsdetailtit">
                <h2>{{newsitem.healthMessage.infoTitle}}</h2>
                <p><span> {{newsitem.healthMessage.infoApplyUserName}}  {{newsitem.healthMessage.levelText}}</span><span>{{newsitem.healthMessage.infoVerifyTime.substring(0,10)}}</span></p>
            </div>
            <div class="newsdetailcon">
                {{{newsitem.healthMessage.infoContent}}}
            </div>
        </div>

       <!--  <div class="foot">
            <div @click="dianzhan" class="zhan1" :class="{zhan2:newsitem.likedFlag!='0'}">{{newsitem.healthMessage.likedCount}}</div>
            <div class="collection" @click="shoucang" :class="{collection2:newsitem.collectionedFlag!=0}">收藏</div>
            <div class="share" @click="sharenews">分享</div>
        </div> -->
    </div>
</template>
<script>
import 'assets/reset.css'
import Public from 'assets/public.js'

export default {
    data() {
            return {
                newsitem: {
                    healthMessage: {
                        infoTitle: "",
                        infoContent: "",
                        infoApplyUserName: "",
                        levelText: "",
                        infoVerifyTime: "",
                        likedCount: "",
                        infoTitlePicture: ""
                    },
                    //collectionedFlag: "",
                    //likedFlag: "",
                },
                // zhan: { //点赞保存参数
                //     "likeObjType": "", //点赞对象,"041" 患者  "031"医生
                //     "likeObjId": "",
                //     "likedObjType": "061", //被点赞对象,"061"
                //     "likedObjId": "" //被点赞对象Id
                // },
                // cang: { //收藏
                //     "collectionObjType": "",
                //     "collectionObjId": "",
                //     "collectionedObjType": "061",
                //     "collectionedObjId": "", //对应的id
                //     "collectionedObjPicture": "", //被收藏对象图片
                //     "remark": "收藏啦" //备注信息
                // },
                // xiang: { //分享
                //     "shareObjType": "", //分享对象类型,写死"041",患者,"031"医生
                //     "shareObjId": "",
                //     "sharedObjType": "061", //被分享对象类型 写死 "061" 健康咨询
                //     "sharedObjId": "", //对应表Id
                //     "sharedRoute": "", //分享途径,字典base_sharedRoute
                //     "sharedContent": "", //分享内容
                //     "sharedLinkUrl": "" //分享链接
                // },
                tabsign:"",



            }
        },
        components: {

        },
        ready() {
            var that = this;
            // let sharedObjId = Public.getParameter("sharedObjId"); //资讯ID
            // let shareObjType = Public.getParameter("shareObjType"); //041患者 031医生
            // let shareObjId = Public.getParameter("shareObjId"); //mipId
            // this.tabsign = Public.getParameter("tabsign")?Public.getParameter("tabsign"):"1";

            // this.zhan.likeObjType = shareObjType;
            // this.zhan.likeObjId = shareObjId;
            // this.zhan.likedObjId = sharedObjId;

            // this.cang.collectionObjType = shareObjType;
            // this.cang.collectionObjId = shareObjId;
            // this.cang.collectionedObjId = sharedObjId;

            // this.xiang.shareObjType = shareObjType;
            // this.xiang.shareObjId = shareObjId;
            // this.xiang.sharedObjId = sharedObjId;

            // $.when(Public.commonajax("coms.healthMessageService", "getHealthMessage", "[" + sharedObjId + ",'" + shareObjId + "']"))
            let id = Public.getParameter("id"); //资讯ID
             $.when(Public.commonajax("coms.healthMessageService", "getHealthMessage", `[${id},'']`))
                .done(function(res) {
                    if (res.code = 200) {
                        // that.cang.collectionedObjPicture = res.body.healthMessage.infoTitlePicture;
                        // res.body.healthMessage.infoTitlePicture = Public.IMGVIEW_URL() + res.body.healthMessage.infoTitlePicture;
                        // res.body.healthMessage.infoContent = res.body.healthMessage.infoContent.replace(/(style="[^"]+")/g, "style='width:100%;height:auto'");
                        that.newsitem = res.body;
                        // that.newsitem.healthMessage.sharedObjId = sharedObjId;
                        // that.newsitem.healthMessage.shareObjType = shareObjType;
                        // that.newsitem.healthMessage.shareObjId = shareObjId;
                    }


                });


        },
        methods: {
            // dianzhan() {
            //         var that = this;
            //         if (that.newsitem.likedFlag == 0) {
            //             $.when(Public.commonajax("coms.healthMessageService", "updateMessageLikedCount", "['" + that.newsitem.healthMessage.sharedObjId + "','" + that.newsitem.healthMessage.shareObjId + "']")).done(function(res) {
            //                 if (res.code = 200) {
            //                     that.newsitem.likedFlag = "1";
            //                     that.newsitem.healthMessage.likedCount = res.body.likedCount;

            //                 }
            //             });
            //         }
            //     },
            //     shoucang() {
            //         var that = this;
            //             $.when(Public.commonajax("coms.healthMessageService", "updateMessageCollectioned","['" + that.newsitem.healthMessage.sharedObjId + "','" + that.newsitem.healthMessage.shareObjId + "']")).done(function(res) {
            //                 if (res.code = 200) {
            //                     // Public.ajaxPrompt("收藏成功");
            //                     that.newsitem.collectionedFlag =that.newsitem.collectionedFlag == 0?that.newsitem.collectionedFlag=1:that.newsitem.collectionedFlag = 0
            //                 } else {
            //                     Public.ajaxPrompt(res.msg)
            //                 }
            //             });

            //     },
            //     sharenews(){
            //         var sharecon={
            //             url:window.location.href,
            //             tit:this.newsitem.healthMessage.infoTitle
            //         };

            //     },
                // returnlist(){
                //      window.location.replace("apphealthnewslist.html?sharedObjId="+this.newsitem.healthMessage.sharedObjId+"&shareObjType="+this.newsitem.healthMessage.shareObjType+"&shareObjId="+this.newsitem.healthMessage.shareObjId+"&tabsign="+this.tabsign);
                // }

        }
}
</script>
<style scoped>
/*.header {
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: #23be82;
    color: #fff;
    position: relative;
    text-align: center;
}

.header a {
    display: block;
    top: 0;
    color: #fff;
    padding: 0 10px;
}

.hd-title {
    line-height: 60px;
    font-size: 18px;
}

.return {
    display: block;
    width: 30px;
    height: 60px;
    background: #23be82 url(../../assets/img/return-bg.png) no-repeat center center;
    background-size: auto 45%;
    position: absolute;
    font-size: 0;
}

.add {
    position: absolute;
    top: 0;
    right: 10px;
}
*/
.newsdetail {
    font-size: 14px;
}

.newsdetailtit,
.newsdetailcon {
    line-height: 26px;
}




.newsdetailtitimg {
    position: relative;
    min-height: 80px
}

.newsdetailtit {
    padding: 15px;
    border-bottom: 1px solid #ccc
}

.newsdetailcon {
    padding: 15px;
}

.newsdetail h2 {
    font-size: 16px;
    line-height: 30px;
}

.newsdetailtit p span {
    display: inline-block;
    padding: 0 10px 0 20px;
    color: #ccc
}

.newsdetailtit p span:nth-child(1) {
    background: url(../../assets/img/userbg.png) no-repeat left center;
    background-size: auto 50%;
}

.newsdetailtit p span:nth-child(2) {
    background: url(../../assets/img/timeover.png) no-repeat left center;
    background-size: auto 50%;
}
/*
.zhan1 {
    background: url(../../assets/img/zhan1.png) no-repeat 15px center;
    background-size: auto 70%;
}

.zhan2 {
    background: url(../../assets/img/zhan2.png) no-repeat 15px center;
    background-size: auto 70%;
}

.collection {
    background: url(../../assets/img/sc1.png) no-repeat 15px center;
    background-size: auto 70%;
}

.collection2 {
    background: url(../../assets/img/sc2.png) no-repeat 15px center;
    background-size: auto 70%;
}

.share {
    background: url(../../assets/img/share1.png) no-repeat 15px center;
    background-size: auto 70%;
}

.foot {
    width: 100%;
    border-top: 2px solid #ccc;
    position: fixed;
    bottom: 0;
    background: #fff;
    padding: 10px 0;
    color: #333;
}

.foot>div {
    width: 33.33%;
    box-sizing: border-box;
    float: left;
    height: 30px;
    line-height: 30px;
    padding-left: 50px;
    text-align: left;
    border-right: 1px solid #1dc499;
}

.foot>div:nth-child(1) {}

.foot>div:nth-child(2) {}

.foot>div:nth-child(3) {
    border-right: none
}

.newsdetail {
    padding-bottom: 50px;
}*/
</style>
